<template>
	<div class="">
		<div class="doneContainer">
			<div class="actSet itemBox">
				<Title msg="活动设置"></title>
				<div class="contentBox">
					<div class="operateDiv">
						<p class="operateText">活动主题：</p>
						<el-input placeholder="活动主题" :value="activityTheme" disabled></el-input>
					</div>
					<div class="operateDiv">
						<p class="operateText">活动内容：</p>
						<el-input placeholder="活动内容" :value="activityContent" disabled></el-input>
					</div>
					<div class="operateDiv">
						<p class="operateText" style="margin-left: -1.6%;">所属活动：</p>
						<span v-text="belongAct" class="txt"></span>
					</div>
					<div class="operateDiv">
						<p class="operateText" style="margin-left: -1.6%;">首页显示：</p>
						<span v-text="indexShow" class="txt"></span>
					</div>
					<div class="operateDiv">
						<p class="operateText" style="margin-left: -1.6%;">活动列表显示：</p>
						<span v-text="actListShow" class="txt"></span>
					</div>
					<div class="operateDiv" v-show="indexShowDiv" style="margin-left: -1.6%;">
						<p class="operateText">首页图片：</p>
						<img :src='indexImg' class='showImg' @click="enlargeImg"/>
					</div>
					<div class="operateDiv" v-show="actListShowDiv" style="margin-left: -1.6%;">
						<p class="operateText">活动列表图片：</p>
						<img :src='actListImg' class='showImg' @click="enlargeImg"/>
					</div>
					<div class="operateDiv">
						<p class="operateText">活动详情页面：</p>
						<el-input placeholder="活动详情" :value="actDetailName" disabled></el-input>
					</div>
				</div>
			</div>
			<div class="baseSet itemBox">
				<Title msg="基础设置"></title>
				<div class="contentBox">
					<div class="operateDiv">
						<p class="operateText">领取类型：</p>
						<el-input placeholder="领取类型" :value="getType" disabled style="width:13%"></el-input>
					</div>
					<div class="operateDiv">
						<p class="operateText">活动场景：</p>
						<el-input placeholder="活动场景" :value="actType" disabled style="width:13%"></el-input>
					</div>
					<div class="operateDiv">
						<p class="operateText">活动开始时间：</p>
						<el-input placeholder="活动开始时间：" :value="actStart" disabled style="width:13%"></el-input>
					</div>
					<div class="operateDiv">
						<p class="operateText">活动结束时间：</p>
						<el-input placeholder="活动结束时间：" :value="actEnd" disabled style="width:13%"></el-input>
					</div>
					<div class="operateDiv">
						<p class="operateText">活动开放日期：</p>
						<span v-text="actOpenDate" class="txt"></span>
					</div>
					<div class="operateDiv">
						<p class="operateText">活动开放时间：</p>
						<span v-text="actOpenTime" class="txt"></span>
					</div>
				</div>
			</div>
			<div class="ruleSet itemBox">
				<Title msg="规则设置"></title>
				<div class="contentBox">
					<span class="titleItem" style="margin-top:40px">发送规则</span>
					<div class="ruleBox">
						<!-- 打折 -->
						<div v-if="receiveType == '993023'">
							<div class="operateDiv">
								<p class="operateText">折扣类型：</p>
								<span v-text="discountName" class="txt"></span>
							</div>
							<div class="operateDiv">
								<p class="operateText">用户标签：</p>
								<span v-text="userTab" class="txt"></span>
							</div>
						</div>
						<div v-else>
							<div class="operateDiv">
								<p class="operateText">用户标签：</p>
								<span v-text="userTab" class="txt"></span>
							</div>
							<div class="operateDiv" v-show="activityTypeDiv">
								<p class="operateText">返现类型：</p>
								<span v-text="activityTypeRule" class="txt"></span>
							</div>
							<div class="operateDiv">
								<p class="operateText">用户单次参加次数：</p>
								<span v-html="userSingleCountNum" class="txt"></span>
							</div>
							<div class="operateDiv">
								<p class="operateText">用户活动参加次数：</p>
								<span v-html="userTotalCountNum" class="txt"></span>
							</div>
							<div class="operateDiv">
								<p class="operateText">用户单次获取金额：</p>
								<span v-html="userSingleMoneyNum" class="txt"></span>
							</div>
							<div class="operateDiv">
								<p class="operateText">用户活动获取金额：</p>
								<span v-html="userTotalMoneyNum" class="txt"></span>
							</div>
							<div class="operateDiv">
								<p class="operateText">总领取人数：</p>
								<span v-text="userGetNum" class="txt"></span>
							</div>
							<div class="operateDiv">
								<p class="operateText">总发放金额：</p>
								<span v-text="userSendNum" class="txt"></span>
							</div>
						</div>
					</div>
					<span class="titleItem" style="margin-top:.2rem">微信分享设置</span>
					<div class="ruleBox">
						<div class="operateDiv">
							<p class="operateText">分享标题：</p>
							<el-input placeholder="分享标题" :value="shareTitle" disabled></el-input>
						</div>
						<div class="operateDiv">
							<p class="operateText">分享描述：</p>
							<el-input placeholder="分享描述" :value="shareContent" disabled></el-input>
						</div>
						<div class="operateDiv">
							<p class="operateText" style="margin-left: -1.6%;">分享图片：</p>
							<img :src='shareImg' class='showImg' @click="enlargeImg"/>
						</div>
					</div>
				</div>
			</div>
			<div class="prizeSet itemBox">
				<Title msg="奖项设置"></title>
				<!-- 打折 -->
				<div class="contentBox" v-if="activityType == '993023'" style="display:flex;flex-direction:row;">
					<div class="allStatus">
						<el-checkbox v-model="checked" disabled>全部电站</el-checkbox>
						<img src="~_assets/dztip.png" class="pictip"/>
						<span>包含所有正在对外运营的充电站</span>
					</div>
					<bootstrap-table :my_columns="my_columns" :my_data="data1" :my_options="my_options" ref="table1" style="width:52%;padding-top: 0.375rem;"></bootstrap-table>
					<div class="rightDiv" style="width:40%;margin-top:.15rem">
						<!-- <p class="setText">电站折扣设置</p> -->
						<div class="operateDiv" v-if="activityGroup">
							<p class="operateText" style="width:19%">分组信息:</p>
							<p class="seeGroupBtn" @click="showStationDialog(2,2)">查看分组</p>
						</div>
						<div class="operateDiv">
							<p class="operateText" style="width:19%">折扣设置:</p>
							<el-input placeholder="请输入折扣" disabled v-model="discountRule" class="setInput" clearable style="width:40%">
							</el-input>
						</div>
						<div class="operateDiv">
							<p class="operateText" style="width:19%">折扣项目:</p>
							<el-radio v-model="offObj" label="1" style="width:40%" disabled>服务费</el-radio>
							<!-- <el-radio v-model="radio" label="2">全账单</el-radio>
							<img src="~_assets/zdtip.png" class="pictip"/><span>系统会优先使用全账单全账单折扣活动</span> -->
						</div>
						<div class="operateDiv">
							<p class="operateText" style="width:19%">折扣时段:</p>
							<el-checkbox-group v-model="discountElecType" style="width:50%" disabled>
								<el-checkbox label="4">峰时</el-checkbox>
								<el-checkbox label="2">平时</el-checkbox>
								<el-checkbox label="1">谷时</el-checkbox>
							</el-checkbox-group>
						</div>
						<div class="operateDiv">
							<p class="operateText" style="width:19%">优惠叠加:</p>
							<el-checkbox v-model="isActivityIsAccumulate" disabled>享受优惠券</el-checkbox>
							<el-checkbox v-model="isRedIsAccumulate" disabled>享受红包</el-checkbox>
						</div>
					</div>
				</div>
				<!-- 返现 -->
				<div class="contentBox ladderBox" v-if="activityType == '993022'">
					<el-tabs 
						v-model="editableTabsValue" 
						type="card" 
						:before-leave="changeTab"
						style="width:98%"
						>
						<el-tab-pane v-for="(item,index) in editableTabs" :key="item.name" :label="item.title" :name="item.name">
							<AddCashbackDone :prizeID="prizeID" :awardSort="index+1" :ref="'prizeItem'+(index+1)" :lotterData="lotterData"></AddCashbackDone>
						</el-tab-pane>
					</el-tabs>
				</div>
				<!-- 优惠 -->
				<div class="contentBox ladderBox" v-else>
					<el-tabs 
						v-model="editableTabsValue" 
						type="card" 
						:before-leave="changeTab"
						style="width:98%"
						>
						<el-tab-pane v-for="(item,index) in editableTabs" :key="item.name" :label="item.title" :name="item.name">
							<AddPrizeDone :prizeID="prizeID" :awardSort="index+1" :ref="'prizeItem'+(index+1)" @showStationDialog="showStationDialog" :lotterData="lotterData"></AddPrizeDone>
						</el-tab-pane>
					</el-tabs>
				</div>
			</div>
			<div class="actStatus itemBox">
				<Title msg="活动状态"></title>
				<div class="contentBox">
					<div class="operateDiv">
						<p class="operateText">活动状态：</p>
						<span v-text="actStatus" class="txt"></span>
					</div>
					<div class="operateDiv">
						<p class="operateText">审核进度：</p>
						<span v-text="checkStep" class="txt"></span>
					</div>
					<div class="operateDiv">
						<p class="operateText">活动进度：</p>
						<ActStep :step="actStep"></ActStep>
					</div>
				</div>
			</div>
			<div class="doneOK" @click="doneOK(2)" v-if="isDetail == 0">确认提交</div>
			<div class="btns" v-if="isDetail == 2">
				<div class="pageBtn toback" @click="doneOK(0)">审核驳回</div>
				<div class="pageBtn next" @click="doneOK(1)">审核通过</div>
			</div>
			<div class="bg" v-show="showImg" @click="showImg = false">
				<img :src="selectImg">
			</div>
		</div>
		<PowerStation v-if="showStation" @closeStation="closeStation" type="{type:2,groupType:2}" :ids="activityGroup"></PowerStation>
	</div>
</template>

<script>
	let timeType = {
		'4':'峰时',
		'2':'平时',
		'1':'谷时'
	}
	let lotteryID = null

	import Step from '_components/Step'
	import Title from './children/Title'
	import ActStep from './children/ActStep'
	import AddPrizeDone from './children/AddPrizeDone'
	import AddCashbackDone from './children/AddCashbackDone'
	import PowerStation from '_components/PowerStation'
	import Bus from '@/bus.js'
	import {unload} from '../../assets/unload.png'
	
	import {
		FIND_SETTING_BY_CODE,
		FIND_BASIS_BY_CODE,
		FIND_DISCOUNT_CHARGE_BY_CODE,
		FIND_RULE_LOTTERY_BY_CODE,
		FIND_LOTTERY_BY_CODE,
		FIND_USABLE_SITE_BY_PARAM,
		SAVE_OR_EDIT_SETTING,
		FIND_COUPON_RED_BY_CODE,
		FIND_CASHBACK_BY_CODE,
		} 
	from '@/config/url'

	let position = {
		'1':'一',
		'2':'二',
		'3':'三',
		'4':'四',
		'5':'五',
		'6':'六',
		'7':'七',
		'8':'八',
		'9':'九',
	}
	export default {
		components:{
			Step,
			Title,
			ActStep,
			AddPrizeDone,
			PowerStation,
			AddCashbackDone
		},
		data() {
			return {
				params:{
					activityCode:sessionStorage.getItem('activityCode'),
					repeatRecord:sessionStorage.getItem('repeatRecord')
				},
				activityCode:sessionStorage.getItem('activityCode'),
				repeatRecord:sessionStorage.getItem('repeatRecord'),
				activityTheme:'',
				activityContent:'',
				belongAct:'',
				indexShow:'',
				actListShow:'',
				indexImg:unload,
				actListImg:unload,
				actDetailName:'',
				getType:'',
				actType:'',
				actStart:'',
				actEnd:'',
				actOpenDate:'',
				actOpenTime:'',
				receiveType:null,//规则类型
				discountType:null,
				discountName:null,
				userTab:'',//用户标签
				userSingleCountNum:'',//用户单次参加次数
				userTotalCountNum:'',//用户活动参加次数
				userSingleMoneyNum:'',//用户单次获取金额
				userTotalMoneyNum:'',//用户活动获取金额
				userGetNum:'',//总领取人数
				userSendNum:'',//总发放金额
				shareTitle:'',//微信分享标题
				shareContent:'',//微信分享内容
				shareImg:unload,//微信分享图片
				actStatus:'',
				checkStep:'',
				actStep:[],
				activeName:'0',
				activityGroup:null,//优惠分组
				showStation:false,//显示分组
				indexShowDiv: true,
				actListShowDiv: true,
				activityTypeDiv:false,
				activityTypeRule:'',//规则返现类型
				page:1,
				size:10,
				rules:[
					// {
					// 	prizeReason:'无',
					// 	getReason:'无',
					// 	commonPrize:[
					// 		{
					// 			type:'1',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'2',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2~10',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'3',
					// 			name:'熊猫抱枕',
					// 			img:'http://pic15.nipic.com/20110813/1993003_205156492136_2.jpg',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'2',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'2',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'2',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'2',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'2',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		// {
					// 		// 	type:'2',
					// 		// 	name:'五元优惠券',
					// 		// 	prizeType:'优惠券',
					// 		// 	costMoney:'25',
					// 		// 	offMoney:'2',
					// 		// 	rate:'10000',
					// 		// 	useTime:'平时/峰时',
					// 		// 	useType:'充电',
					// 		// 	time:'2019-4-28到2019-5-28'
					// 		// },
					// 		// {
					// 		// 	type:'2',
					// 		// 	name:'五元优惠券',
					// 		// 	prizeType:'优惠券',
					// 		// 	costMoney:'25',
					// 		// 	offMoney:'2',
					// 		// 	rate:'10000',
					// 		// 	useTime:'平时/峰时',
					// 		// 	useType:'充电',
					// 		// 	time:'2019-4-28到2019-5-28'
					// 		// },
					// 		// {
					// 		// 	type:'2',
					// 		// 	name:'五元优惠券',
					// 		// 	prizeType:'优惠券',
					// 		// 	costMoney:'25',
					// 		// 	offMoney:'2',
					// 		// 	rate:'10000',
					// 		// 	useTime:'平时/峰时',
					// 		// 	useType:'充电',
					// 		// 	time:'2019-4-28到2019-5-28'
					// 		// },
					// 		// {
					// 		// 	type:'2',
					// 		// 	name:'五元优惠券',
					// 		// 	prizeType:'优惠券',
					// 		// 	costMoney:'25',
					// 		// 	offMoney:'2',
					// 		// 	rate:'10000',
					// 		// 	useTime:'平时/峰时',
					// 		// 	useType:'充电',
					// 		// 	time:'2019-4-28到2019-5-28'
					// 		// },
					// 	],
					// 	superRed:'启用惊喜红包'
					// },
					// {
					// 	prizeReason:'有2',
					// 	getReason:'有',
					// 	commonPrize:[
					// 		{
					// 			type:'2',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2~10',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'3',
					// 			name:'熊猫抱枕',
					// 			img:'_assets/logo.png',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'2',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 	],
					// 	superRed:'启用惊喜红包'
					// },
					// {
					// 	prizeReason:'有3',
					// 	getReason:'有',
					// 	commonPrize:[
					// 		{
					// 			type:'2',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2~10',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'3',
					// 			name:'熊猫抱枕',
					// 			img:'_assets/logo.png',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'2',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 	],
					// 	superRed:'启用惊喜红包'
					// },
					// {
					// 	prizeReason:'有4',
					// 	getReason:'有',
					// 	commonPrize:[
					// 		{
					// 			type:'2',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2~10',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'3',
					// 			name:'熊猫抱枕',
					// 			img:'_assets/logo.png',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'2',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 	],
					// 	superRed:'启用惊喜红包'
					// },
					// {
					// 	prizeReason:'有5',
					// 	getReason:'有',
					// 	commonPrize:[
					// 		{
					// 			type:'2',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2~10',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'3',
					// 			name:'熊猫抱枕',
					// 			img:'_assets/logo.png',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'2',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 	],
					// 	superRed:'启用惊喜红包'
					// },
					// {
					// 	prizeReason:'有6',
					// 	getReason:'有',
					// 	commonPrize:[
					// 		{
					// 			type:'2',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2~10',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'3',
					// 			name:'熊猫抱枕',
					// 			img:'_assets/logo.png',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'2',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 	],
					// 	superRed:'启用惊喜红包'
					// },
					// {
					// 	prizeReason:'有7',
					// 	getReason:'有',
					// 	commonPrize:[
					// 		{
					// 			type:'2',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2~10',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'3',
					// 			name:'熊猫抱枕',
					// 			img:'_assets/logo.png',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'2',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 	],
					// 	superRed:'启用惊喜红包'
					// },
					// {
					// 	prizeReason:'有8',
					// 	getReason:'有',
					// 	commonPrize:[
					// 		{
					// 			type:'2',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2~10',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'3',
					// 			name:'熊猫抱枕',
					// 			img:'_assets/logo.png',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'2',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 	],
					// 	superRed:'启用惊喜红包'
					// },
					// {
					// 	prizeReason:'有9',
					// 	getReason:'有',
					// 	commonPrize:[
					// 		{
					// 			type:'2',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2~10',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'3',
					// 			name:'熊猫抱枕',
					// 			img:'_assets/logo.png',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 		{
					// 			type:'2',
					// 			name:'五元优惠券',
					// 			prizeType:'优惠券',
					// 			costMoney:'25',
					// 			offMoney:'2',
					// 			rate:'10000',
					// 			useTime:'平时/峰时',
					// 			useType:'充电',
					// 			time:'2019-4-28到2019-5-28'
					// 		},
					// 	],
					// 	superRed:'启用惊喜红包'
					// },
				],
				operator:null,//操作人
				showImg:false,//显示图片
				selectImg:'',//放大的图片
				activityType:null,//奖品类型
				offObj:'1',
				discountElecType:[],
				discountRule:null,
				isActivityIsAccumulate:false,
				isRedIsAccumulate:false,
				my_columns:[{
						title: '序号',
						field: '',
						formatter: function(i, row, index) {
							return index + 1;
						}
					},
					{
						title: '电站名称',
						field: 'name',
						formatter: function(i, row, index) {
							return i;
						}
					},
					{
						title: "状态",
						field: "status",
						formatter: function(i, row, index){
							if(i == 120010){
								return '启用'
							}else if(i == 120011){
								return '建设中'
							}else if(i == 120012){
								return '禁用'
							}
						}
					},],
				my_options:{},
				data1:[],
				editableTabs:[],
				editableTabsValue:'ladder1',
				lotterData:null,
				prizeID:null,
				tests:[
					{title:'title',name:'name'}
				],
				test:name,
				taskId:sessionStorage.getItem('taskId'),//工作流id
				isDetail:sessionStorage.getItem('detail'),//详情 查看
				activityVerifyStatus:null,//状态
				checked:false,//全部电站
			};
		},
		created(){
			sessionStorage.setItem('lotterySort',1)
		},
		mounted(){
			this.getSetting()
			this.getBasis()
		},
		methods:{
			getSetting(){
				let that = this
				this.$fetch(FIND_SETTING_BY_CODE,this.params)
					.then(res=>{
						if(res.status == 1){
							let item = res.data
							if(item){
								this.activityTheme = item.activityTheme
								this.activityContent = item.activityContent
								this.belongAct = (item.activityAttribution == '181010' ? '充电系统' : '')
								this.indexShow = (item.homeShow == '1' ? '首页显示' : '首页不显示')
								this.actListShow = (item.activityShow == '1' ? '显示' : '不显示')
								this.indexImg = this.PIC_URL + item.homeImg
								this.actListImg = this.PIC_URL + item.activityImg
								this.actDetailName = item.avtivityModel
								this.actStep[0] = item.operator
								this.operator = item.operator
	
	
								if(item.homeShow == 1){
									this.indexShowDiv = true
								}else{
									this.indexShowDiv = false
								}
								if(item.activityShow == 1){
									this.actListShowDiv = true
								}else{
									this.actListShowDiv = false
								}
	
								if(item.activityStatus == '990013'){
									this.actStatus = '下架'
								}else if(item.activityStatus == '990014'){
									this.actStatus = '上架'
								}else if(item.activityStatus == '990020'){
									this.actStatus = '作废'
								}
	
								if(item.activityVerifyStatus == '981005'){
									this.checkStep = '审核失败'
								}else if(item.activityVerifyStatus == '981001'){
									this.checkStep = '新建'
								}else if(item.activityVerifyStatus == '981002'){
									this.checkStep = '待复录'
								}else if(item.activityVerifyStatus == '981003'){
									this.checkStep = '复录失败'
								}else if(item.activityVerifyStatus == '981004'){
									this.checkStep = '待审核'
								}else if(item.activityVerifyStatus == '981006'){
									this.checkStep = '审核成功'
								}
								let arr = []
								arr[0] = item.operator || '初录人'
								arr[1] = item.repeatOperator || '复录人'
								arr[2] = item.operatorVerify || '审核人'
								this.actStep = arr
							}
						}else{
							// this.$message({
							// 	message: res.data,
							// 	type: 'warning'
							// });
						}
					})
					.catch(err=>{
						console.log(err)
						// this.$message({
						// 	message: '获取失败',
						// 	type: 'warning'
						// });
					})
			},
			getBasis(){
				this.$fetch(FIND_BASIS_BY_CODE,this.params)
					.then(res=>{
						if(res.status == 1){
							let item = res.data
							if(item){
								let type = item.receiveType
								this.receiveType = item.receiveType
								if(type){
									this.getRule(type)//获取规则
								}
								let scenes = item.activityScenes
								let actData = item.activityCycleDate
	
								sessionStorage.setItem('receiveType',type)
								
								if(type == '993023'){
									type = '打折奖励'
								}else if(type == '993024'){
									type = '抽取奖励'
								}else if(type == '993025'){
									type = '领取奖励'
								}else if(type == '993022'){
									type = '返现'
								}
								
								if(scenes == '994001'){
									scenes = '注册活动'
								}else if(scenes == '994002'){
									scenes = '充值活动'
								}else if(scenes == '994003'){
									scenes = '充电活动'
								}else if(scenes == '994004'){
									scenes = '页面活动'
								}else if(scenes == '994005'){
									scenes = '分享活动'
								}
	
								if(null == actData || undefined == actData || '' == actData || 'null' == actData || 0 == actData){
									actData = item.activityCycleWeek
								}
								if(actData == '0' || actData == ''){
									actData = '全时段'
								}

								this.getType = type
								this.actType = scenes
								this.actStart = item.startTime
								this.actEnd = (item.endTime == '0' ? '不限制' : item.endTime)
								this.actOpenDate = actData
								this.actOpenTime = (item.activityCycleTime == '0' ? '全时段' : item.activityCycleTime.replace(',','~'))
							}							
						}else{
							// this.$message({
							// 	message: res.data,
							// 	type: 'warning'
							// });
						}
					})
					.catch(err=>{
						console.log(err)
						// this.$message({
						// 	message: '获取失败',
						// 	type: 'warning'
						// });
					})
			},
			getFirstLottery(){
				let that = this
				this.$fetch(FIND_LOTTERY_BY_CODE,
					{
						"activityCode":this.activityCode,
						'repeatRecord':this.repeatRecord
					}
				)
				.then(res=>{
					if(res.status == 1){
						if(res.data.length > 0){
							if(that.editableTabs.length == 0){
								for(let i=0;i<res.data.length;i++){
									that.editableTabs.push({
										title: '阶梯'+ position[i+1],
										name: 'ladder'+ (i+1),
										content: 'New Tab content'
									});
								}
							}
							this.lotterData = res.data
							this.$store.commit('setFirstLotteryData',res.data)
							this.$store.commit('setCurrentLottery',res.data[sessionStorage.getItem('lotterySort')-1].id)
							if(sessionStorage.getItem('receiveType') == 993022){
								that.lotterData = res.data[0]
								this.getCashback(res.data[0].id)
							}else{
								this.getCoupon()
							}
						}
					}
				})
				.catch(err=>{
					console.log(err)
					// this.$message({
					// 	message: '获取失败',
					// 	type: 'warning'
					// });
				})
			},
			getRule(type){
				this.params.receiveType = type
				this.$fetch(FIND_RULE_LOTTERY_BY_CODE,this.params)
					.then(res=>{
						let data = res.data
						if(res.status == 1 && data){
							this.discountType = data.discountType
							if(data.activityType){
								this.activityType = data.activityType
								if(data.activityType == '993023'){
									this.getDiscout()
								}else{
									this.getFirstLottery()
								}
							}
							if(data.activityType == '993022'){
								this.activityTypeDiv = true
								if(data.cashbackType == '986001'){
									this.activityTypeRule = '固定返现'
								}else if(data.cashbackType == '986002'){
									this.activityTypeRule = '随机返现'
								}else if(data.cashbackType == '986003'){
									this.activityTypeRule = '百分比返现'
								}
							}else{
								this.activityTypeDiv = false
							}
							if(type == '993023'){
								if(data.discountType == '983001'){
									this.discountName = '电站打折'
								}else if(data.discountType == '983002'){
									this.discountName = '优惠分组打折'
								}

								if(data.userLabel == '982001'){
									this.userTab = '全部用户'
								}else if(data.userLabel == '982002'){
									this.userTab = '全部会员'
								}else if(data.userLabel == '982003'){
									this.userTab = '会员自动充电'							
								}else if(data.userLabel == '982004'){
									this.userTab = '非会员'								
								}
							}else{
								if(data.userLabel == '982001'){
									this.userTab = '全部用户'
								}else if(data.userLabel == '982002'){
									this.userTab = '全部会员'
								}else if(data.userLabel == '982003'){
									this.userTab = '会员自动充电'							
								}else if(data.userLabel == '982004'){
									this.userTab = '非会员'								
								}
								if(data.userSingleCount == 0){
									this.userSingleCountNum = '无限制'
								}else{
									this.userSingleCountNum = `每${data.limitCount}日可参与${data.userSingleCount}次`
								}
								if(data.userTotalCount == 0){
									this.userTotalCountNum = '无限制'
								}else{
									this.userTotalCountNum = `周期活动 可参与${data.userTotalCount}次`
								}
								if(data.userSingleMoney == 0){
									this.userSingleMoneyNum = '无限制'
								}else{
									this.userSingleMoneyNum = `${data.limitMoney}日 最高领取${data.userSingleMoney}元`
								}
								if(data.userTotalMoney == 0){
									this.userTotalMoneyNum = '无限制'
								}else{
									this.userTotalMoneyNum = `周期活动 最高领取${data.userTotalMoney}元`
								}
								this.userJoinNum = data.userJoinCount
								this.userGetNum = data.userReceiveTotal == 0?'无限制':data.userReceiveTotal
								this.userSendNum = data.moneyReceiveTotal== 0?'无限制':data.moneyReceiveTotal
							}
							this.shareTitle = data.shareTitle
							this.shareContent = data.shareContent
							this.shareImg = this.PIC_URL + data.shareImg
						}else{
							// this.$message({
							// 	message: res.data,
							// 	type: 'warning'
							// });
						}
					})
					.catch(err=>{
						console.log(err)
						// this.$message({
						// 	message: '获取失败',
						// 	type: 'warning'
						// });
					})
			},
			getDiscout(){
				this.$fetch(FIND_DISCOUNT_CHARGE_BY_CODE,{
					activityCode:sessionStorage.getItem('activityCode'),
					activityType:this.activityType,
					repeatRecord:this.repeatRecord
				})
					.then(res=>{
						if(res.status == 1){
							let item = res.data
							if(item){
								this.discountRule = item.discountRule
								this.isActivityIsAccumulate = item.activityIsAccumulate==0?false:true
								this.isRedIsAccumulate = item.redIsAccumulate==0?false:true
								this.discountElecType = item.discountElecType.split(',')
								this.activityGroup = item.activityGroup
								if(item.activityBuild == '0'){
									this.checked = true
								}else{
									this.checked = false
									this.getStation(item.activityBuild)
								}

							}
						}else{
							// this.$message({
							// 	message: res.data,
							// 	type: 'warning'
							// });
						}
					})
					.catch(err=>{
						console.log(err)
						// this.$message({
						// 	message: '获取失败',
						// 	type: 'warning'
						// });
					})
			},
			getStation(buildId){
				this.buildId = buildId
				this.my_options = {
					pagination: true,
					sidePagination: "server",
					url: FIND_USABLE_SITE_BY_PARAM,
					queryParams: this.getParams
				};				
				// this.$fetch(FIND_USABLE_SITE_BY_PARAM,{
				// 	buildId:buildId
				// })
				// .then(res=>{
				// 	if(res.status == 1){
				// 		this.data1 = res.data
				// 	}else{
				// 	this.$message({
				// 		message: res.data,
				// 		type: 'warning'
				// 	});
				// 	}
				// })
				// .catch(err=>{
				// 	console.log(err)
				// 	this.$message({
				// 		message: '获取失败',
				// 		type: 'warning'
				// 	});
				// })
			},
			getParams() {
				let param = {
					buildId:this.buildId,
					page: this.$refs.table1.local.options.pageNumber,
					size: this.$refs.table1.local.options.pageSize
				};
				return param;
			},
			getCashback(id){
				let that = this
				this.$fetch(FIND_CASHBACK_BY_CODE,
					{
						'activityCode':this.activityCode,
						'repeatRecord':this.repeatRecord,
						'lotteryId':id
					}
				)
				.then(res=>{
					if(res.status == 1){
						if(res.data.length > 0){
							this.$store.commit('setFirstCouponData',null)
							this.$store.commit('setFirstCouponData',res.data)
						}
					}
				})
				.catch(err=>{
					console.log(err)
					// this.$message({
					// 	message: '获取失败',
					// 	type: 'warning'
					// });
				})
			},
			getCoupon(){
				let id = this.$store.getters.getCurrentLottery
				this.$fetch(FIND_COUPON_RED_BY_CODE,{
					activityCode:sessionStorage.getItem('activityCode'),
					repeatRecord:this.repeatRecord,
					lotteryId:id
				})
					.then(res=>{
						let data = res.data
						this.rules = []
						if(res.status == 1){
							if(res.data.length > 0){
								this.$store.commit('setFirstCouponData',null);
								this.$store.commit('setFirstCouponData',res.data);
							}else{
								this.$store.commit('setFirstCouponData',null);
							}
						}else{
							// this.$message({
							// 	message: res.data,
							// 	type: 'warning'
							// });
						}
					})
					.catch(err=>{
						console.log(err)
						// this.$message({
						// 	message: '获取失败',
						// 	type: 'warning'
						// });
					})
			},
			getPrize(lotteryItem){
				let itemObj = {
					prizeReason:'null',
					getReason:'null',
					commonPrize:[],
					superRed:'null'
				}
				let pos = lotteryItem[0].awardSort
				itemObj.prizeReason = '无'
				itemObj.getReason = '无'
				itemObj.superRed = '启用惊喜红包'
				for(let i=0;i<lotteryItem.length;i++){
					if(lotteryItem[i].discountsPattern != '0'){
						lotteryItem[i].inputMin = lotteryItem[i].settingReduceMoney.split(',')[0]
						lotteryItem[i].inputMax = lotteryItem[i].settingReduceMoney.split(',')[1]
					}
					itemObj.commonPrize.push(lotteryItem[i])
				}
				this.rules[pos-1] = itemObj
				this.rules = Object.assign({}, this.rules);
			},
			enlargeImg(e){
				this.selectImg = $(e.target).attr('src')
				this.showImg = true
			},
			getTitle(pos){
				let num = '阶梯' + position[pos]
				let title = num
				return title;
			},
			showStationDialog(type,groupType){
				this.showStation = !this.showStation
			},
			closeStation(){
				this.showStation = false
			},
			doneOK(type){
				if(type == 2){
					if(this.repeatRecord == 0){
						this.activityVerifyStatus = '981002'
					}else{
						let fail = sessionStorage.getItem('fail')
						if(fail == 1){
							this.activityVerifyStatus = '981003'
						}else{
							this.activityVerifyStatus = '981004'
						}
					}
				}else if(type == 0){
					this.activityVerifyStatus = '981005'
				}else if(type == 1){
					this.activityVerifyStatus = '981006'
				}
				this.$confirm("确认提交?", "提示", {
					confirmButtonText: "确定",
					cancelButtonText: "取消",
				})
				.then(() => {
					this.$post(SAVE_OR_EDIT_SETTING,{
						activityCode:sessionStorage.getItem('activityCode'),
						activityVerifyStatus:this.activityVerifyStatus,
						// repeatRecord:sessionStorage.getItem('repeatRecord'),
						operator:this.operator,
						taskId:this.taskId
					})
						.then(res=>{
							let data = res.data
							if(res.status == 1){
								this.$message({
									message: '提交成功',
									type: 'success'
								});
								this.$router.replace('/actSettings')
							}else{
								// this.$message({
								// 	message: res.data,
								// 	type: 'warning'
								// });
							}
						})
						.catch(err=>{
							console.log(err)
							// this.$message({
							// 	message: '获取失败',
							// 	type: 'warning'
							// });
						})
				})
				.catch(() => {});
			},
			changeTab(n,o){
				let newPos = n.slice(-1);
				let tabNew = 'prizeItem'+newPos
				sessionStorage.setItem('lotterySort',newPos)

				if(this.$refs[tabNew]){
					if(this.$store.getters.getFirstLotteryData){
						this.$store.commit('setCurrentLottery',this.$store.getters.getFirstLotteryData[newPos-1].id)
						if(sessionStorage.getItem('receiveType') == 993022){
							this.lotterData = this.$store.getters.getFirstLotteryData[newPos - 1]
							this.getCashback(this.$store.getters.getFirstLotteryData[newPos - 1].id)
						}else{
							this.getFirstLottery()
						}
					}
				}

				this.isRemove = false
			},
		}
	}
</script>

<style lang="less">
	@import '~_config/mixin.less';
    @bgCol:#3395FF;

	.doneContainer{
		height: 3.4rem;
		overflow-y: scroll;
		margin-top: 0.2rem;
		.bg(#fff);
		.itemBox{
			margin-top:40px;
			.contentBox{
				padding-left: 6%;
				position: relative;
			}
		}
		.operateText{
			width:13%;
			letter-spacing: 3px;
			text-align: end;
		}
		.operateDiv {
			width: 90%;
			margin: auto;
			margin-top: 40px;
			display: flex;
			justify-content: flex-start;
			align-items: center;
			margin-left: 0;
		}
		.el-input{
			// width:70%;
		}
		.txt{
			letter-spacing: 3px;
		}
		.showImg{
			.wh(100px,100px);
			cursor: pointer;
		}
		.titleItem{
			display:inline-block;
			.wh(auto,40px);
			.sc(22px,@bgCol);
			border-bottom: 2px solid @bgCol;
			margin-left:3%;
		}
		.ruleBox{
			padding-left:8%;
		}
		.doneOK{
			width:190px;
			height:47px;
			background:rgba(51,149,255,1);
			border-radius:8px;
			.sc(.1rem,#fff);
			cursor: pointer;
			text-align:center;
			line-height:47px;
			margin:0 auto;
			margin-top:.4rem;
		}
		.el-input.is-disabled .el-input__inner{
			.bg(#fff)
		}
		.doneTab{
			width:7.6rem;
			.el-tabs__item{
				width: 11%;
				padding: 0;
				font-size:22px;
				font-family:PingFangSC-Regular;
				font-weight:400;
				color:#000;
				text-align: center;
			}
			.el-tabs__item.is-active{
				color:@bgCol;
			}
			.el-tabs__nav-scroll{
				width: 99%;
			}
			.el-tabs__nav{
				width:100%;
			}
		}
		.bg{
			position: fixed;
			z-index: 6;
			.wh(100%,100%);
			background-color: rgba(0, 0, 0, .5);
			top: 0;
			left: 0;
			.fx();
			img{
				height: 90%;
			}
		}
		.ladderBox .el-tabs__nav-scroll {
			border-bottom: 1px solid #F0F1F2;
		}
		
		.ladderBox .el-tabs--card>.el-tabs__header .el-tabs__item.is-active.is-closable {
			background-color: #fff;
			border-top: none;
			border-bottom: 3px solid #3395FF;
		}
		
		.ladderBox .el-tabs--card>.el-tabs__header .el-tabs__item,
		.ladderBox .el-tabs--card>.el-tabs__header .el-tabs__item:first-child {
			border: none;
		}
		.ladderBox .el-tabs--card > .el-tabs__header .el-tabs__item{
			background: none;
			width: 0.8rem;
			text-align: center;
			font-size:0.1rem;
		}
		.ladderBox .el-tabs__nav div:first-child span{
			display: none;
		}
		.ladderBox .el-tabs--card>.el-tabs__header .el-tabs__item.is-active{
			border-bottom: 3px solid #3395FF !important;
		}
		.btns {
			position: fixed;
			bottom:0.15rem;
			left:45%;
			display: flex;
			justify-content: center;
			align-items: center;
		}
		
		.pageBtn {
			width: 0.8rem;
			height: 0.2rem;
			line-height: .2rem;
			text-align: center;
			background: #3395FF;
			border-radius: 8px;
			color: #fff;
			margin-left: 0.2rem;
			cursor: pointer;
		}
		.toback{
			background: red;
		}
		.allStatus{
			position: absolute;
			top: 5%;
		}
	}
	
	
</style>